package com.example.piedrapapeltijeralagartospock;

import java.util.Vector;

import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class MyAdapter extends BaseAdapter {
    private final Activity actividad;
    private final Vector<String> lista;

    public MyAdapter(Activity actividad, Vector<String> lista) {
          super();
          this.actividad = actividad;
          this.lista = lista;
    }

    public View getView(int position, View convertView, ViewGroup parent) {
          LayoutInflater inflater = actividad.getLayoutInflater();
          View view = inflater.inflate(R.layout.list_elemento, null, true);
          TextView player1 =(TextView)view.findViewById(R.id.player1);
          TextView player2 =(TextView)view.findViewById(R.id.player2);
          String [] subString = new String[2];
          subString = lista.elementAt(position).split("/&/");
          player1.setText(subString[0]);
          player2.setText(subString[1]);
          return view;
    }

    public int getCount() {
          return lista.size();
    }

    public Object getItem(int arg0) {
          return lista.elementAt(arg0);
    }

    public long getItemId(int position) {
          return position;
    }
}